package com.yinhechuangji.application.controller;

import com.yinhechuangji.application.entity.UserBase;
import com.yinhechuangji.application.service.UserBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController()
@RequestMapping()
public class TestController {

    @Autowired
    private UserBaseService userBaseService;

    @Autowired
    private DiscoveryClient discoveryClient; //进行Eureka的发现服务


    @GetMapping("/test")
    public UserBase test(){
        return userBaseService.getByPk("0019ce600beb43a989818f64525413b4");
    }
    @GetMapping("/info")
    public DiscoveryClient info(){
        return discoveryClient;
    }
    @GetMapping("/info2")
    public List<ServiceInstance> info2(){
        return discoveryClient.getInstances("eureka-service");
    }


}
